;$(function () {
    layui.use(['layer'], function () {
        // 点击_全景详情页_电话按钮_联系方式浮窗上的任意元素
        $('.bottom-contact-show').on('click', '.js-info-click', function (event) {
            event.stopPropagation()
            event.preventDefault()
            buriedNewLog({
                vr_res_details_page_float_window_element_content: $(this).attr("data-type"),
                buried_type: "click_vr_res_details_page_float_window_element"
            });
        })

        /**
         * 埋点
         */
        $('.call-image').click(function () {
            buriedNewLog({
                vr_res_details_page_float_window_element_content: $(this).attr("data-type"),
                buried_type: "click_vr_res_details_page_float_window_element"
            });
        })

        $('.call-list-text .copy').click(function () {
            buriedNewLog({
                vr_res_details_page_float_window_element_content: 4,
                buried_type: "click_vr_res_details_page_float_window_element"
            });
        })

        $('.call-list-text .call').click(function () {
            buriedNewLog({
                vr_res_details_page_float_window_element_content: 3,
                buried_type: "click_vr_res_details_page_float_window_element"
            });
        })

        function isMobile() {
            return window.screen.width < 768
        }

        if (isMobile()) {

            $('.contact-way').click(function () {
                $(this).toggle()
            })

            $('.contact-call').click(function (e) {
                e.stopPropagation()
            })

            // 电话
            $('.js-contact').click(function (e) {
                e.stopPropagation()

                $('.design-instructions-text').hide()
                $('.link-qrcode').hide()

                $('.contact-way').show()
                $('.bottom-contact-show').toggle()
            });


            $('.design-instructions').click(function (e) {
                e.stopPropagation()
                $('.bottom-contact-show').hide()
                $('.link-qrcode').hide()

                $('.design-instructions-text').toggle()
            })

            $('.sharemg-icon').click(function (e) {
                e.stopPropagation()
                $('.bottom-contact-show').hide()
                $('.design-instructions-text').hide()

                $('.link-qrcode').toggle()
            })

            //  复制微信号
            var btn = document.getElementById('copyWechat');
            if (btn) {
                var clipboard = new ClipboardJS(btn);
                clipboard.on('success', function (e) {
                    $('.contact-way').hide()
                    layer.msg("已将微信号复制到剪贴板");
                    e.clearSelection();
                });

                clipboard.on('error', function (e) {
                    layer.msg("复制失败");
                });

                $('#phone').click(function () {
                    $('.contact-way').hide()
                    window.open('tel:' + $(this).data('phone'))
                })
            }
        }

    })
})